package pl.surecase.eu;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class MyDaoGenerator {

    private final static int DB_VERSION = 1;

    private final static String PKG_NAME = "com.zjt.smart";

    public static void main(String args[]) throws Exception {
        Schema schema = new Schema(DB_VERSION, PKG_NAME + ".bean");
        schema.setDefaultJavaPackageDao(PKG_NAME + ".dao");
        initCacheBean(schema);
        new DaoGenerator().generateAll(schema, "././app/src/main/java-gen");
    }

    private static void initCacheBean(Schema schema) {
        Entity cacheBean = schema.addEntity("CacheBean");
        cacheBean.setTableName("CacheBean");
        cacheBean.addLongProperty("id").primaryKey().index();
        cacheBean.addStringProperty("url");
        cacheBean.addStringProperty("response");
        cacheBean.addLongProperty("time");
    }
}
